﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LeetCodeSolutions
{
    /// <summary>
    /// 26. 删除排序数组中的重复项
    /// </summary>
    class LeetCode26: LeetCodeBase
    {
        public override void Execute()
        {
            throw new NotImplementedException();
        }

        public int RemoveDuplicates(int[] nums)
        {
            if(nums.Length == 0 || nums == null)
            {
                return 0;
            }

            int temp = 1;//移位标记
            for (int i = 1; i < nums.Length; i++)
            {
                if(nums[i] != nums[i-1])
                {
                    nums[temp++] = nums[i];
                }
            }

            return temp;
        }
    }
}
